package top.gokzzz.covert;

import org.springframework.stereotype.Component;
import top.gokzzz.covert.test.entity.User;
import top.gokzzz.covert.test.entity.User2Dto;
import top.gokzzz.covert.test.entity.UserDto;

@Component
public class UserMapperConverter implements MapperConverter {

    public UserDto toUserDto(User user) {
        if (user == null) return null;
        UserDto userDto = new UserDto();
        userDto.setId(user.getId());
        userDto.setUsername(user.getUsername());
        return userDto;
    }

    public User2Dto toUser2Dto(User user) {
        if (user == null) return null;
        User2Dto user2Dto = new User2Dto();
        user2Dto.setUsername(user.getUsername());
        return user2Dto;
    }
}
